﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ParallelRuntimeLibrary
{
    /// <summary>
    /// Indicates to callers than an object may be "canceled" in some manner. It offers a method to initiate
    /// asynchronous cancellation and provides a property to inquire for whether a cancellation request has
    /// been issued.
    /// </summary>
    public interface ISupportsCancellation
    {

        /// <summary>
        /// Asynchronously cancels the instance.
        /// </summary>
        /// <remarks>
        /// There are no guarantees that the cancellation request will succeed, nor is it prohibited for <see cref="M:ParallelRuntimeLibrary.ISupportsCancellation.Cancel" /> to execute synchronously, blocking until the cancellation succeeds.
        /// </remarks>
        void Cancel();

        /// <summary>
        /// Gets whether a cancellation request has been issued on this instance.
        /// </summary>
        /// <value>Whether a cancellation request has been issued on this instance.</value>
        bool IsCanceled { get; }

    }
}
